package hy.clone;

public class Test {
    public static void 浅拷贝(String[] args) throws CloneNotSupportedException {
        Stu s1 = new Stu();
        s1.age = 20;
        Stu s2 = (Stu) s1.clone();
        System.out.println(s1 == s2);
        System.out.println(s2.age);

    }

    public static void main(String[] args)throws Exception {
        Stu s1 = new Stu();
        s1.age = 20;
        s1.t = new Teacher();
        Stu s2 = (Stu) s1.clone();
        s1.age = 40;

        System.out.println(s2.age);
        System.out.println(s1.t==s2.t);
        System.out.println(s1.t.name+",,s2.t.name="+s2.t.name);
    }
}
